import { baseUrl } from "../common/constants";
import { IDirData } from "../components/CodeContainer";
import http from "../core/request";

export const apiGetProjectDownloadUrl = (data: IDirData) => {
    return http.request<{ downloadUrl: string }>({
        url: 'project/createZip',
        method: 'POST',
        data: data
    })
}

export const apiCreateProjectToServer = (data: IDirData) => {
    return http.request<{ projectPath: string }>({
        url: 'project/create',
        method: 'POST',
        data: data
    })
}


export const apiUpdateProjectToServer = (data: IDirData) => {
    return http.request<{ projectPath: string }>({
        url: 'project/update',
        method: 'POST',
        data: data
    })
}
export const apiDownProject = (url: string) => {
    window.open(baseUrl + url)
}